package com.cg.controller;

import com.cg.entity.Product;
import com.cg.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/product")
public class ProductController {

    @Autowired
    ProductService productService;
    @GetMapping("/selectProductById")
    public Product selectProductById(@RequestParam("id") Integer id){
        return productService.selectProductById(id);
    }
    @GetMapping("/selectProductList")
    public List<Product> selectProductList(Product product){
        return productService.selectProductList(product);
    }

    @PutMapping
    public Integer edit(@RequestBody Product product){
        return productService.updateProduct(product);
    }
}
